package com.itheima1.itheima.homework5;

public class Demo5_Store_Producer_Consumer {
    public static void main(String[] args) {
        StoreHouse sh = new StoreHouse(10);
        new Thread(new Producer(sh),"生产").start();
        new Thread(new Consumer(sh),"消费").start();
        /*
        ArrayBlockingQueue<String> list = new ArrayBlockingQueue<>(10);
        //存
        new Thread(()->{
            while (true){
                try {
                    list.put("货物");
                    System.out.println("存入仓库一个货物,剩余"+list.size()+"个");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
        new Thread(()->{
            while (true){
                try {
                    String s = list.take();
                    System.out.println("从仓库取出一个货物,剩余"+list.size()+"个");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
         */
    }
}
